﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace BLO
{
    /// <summary>
    /// Summary description for FriendRequest
    /// </summary>
    public class FriendRequest
    {
        DTO.FriendRequest info;
        DAO.FriendRequest friendRequestDAO;

        public FriendRequest()
        {
            this.friendRequestDAO = new DAO.FriendRequest();
            this.info = new DTO.FriendRequest();
        }

           /// <summary>
        /// FriendRequest Information.
        /// </summary>
        public DTO.FriendRequest Info
        {
            get { return this.info; }
            set { this.info = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ID"></param>
        public static FriendRequest GetFriendRequest(String ID)
        {
            DAO.FriendRequest friendRequestDAO = new DAO.FriendRequest();
            FriendRequest friendRequest = new  FriendRequest();
            friendRequest.Info = friendRequestDAO.GetFriendRequest(ID);
            return friendRequest;
        }

        /// <summary>
        /// Insert FriendRequest information to database.
        /// </summary>
        public int Insert()
        {
            return friendRequestDAO.InsertFriendRequest(this.info);
        }

        /// <summary>
        /// Update information to database.
        /// </summary>
        public int Update()
        {
            return friendRequestDAO.UpdateFriendRequest(this.info);
        }

        /// <summary>
        /// Re-get all information from database about this FriendRequests.
        /// </summary>
        public void Refresh()
        {
            this.info = friendRequestDAO.GetFriendRequest(this.info.ID.ToString());
        }

        /// <summary>
        /// Delete this news from database.
        /// </summary>
        public int Delete()
        {
            return friendRequestDAO.DeleteFriendRequest(this.info);
        }
    }
}